import { h, render } from 'vue'
import messageComponent from './index.vue'

export const message = (type, content, duration = 3000) => {
  //动画结束的回调函数
  const onDestory = () => {
    //3.删除render

    render(null, document.body)
  }
  //渲染流程

  //1. 拿到vnode
  const vnode = h(messageComponent, {
    type,
    content,
    duration,
    destory: onDestory
  })
  //2.render vnode
  render(vnode, document.body)
}
